Allow a NULL marshaller. (gtk_signal_connect_by_type): Allow only
authorMarius Vollmer <mvo@src.gnome.org>
Sun, 6 Dec 1998 22:15:53 +0000 (22:15 +0000)
committerMarius Vollmer <mvo@src.gnome.org>
Sun, 6 Dec 1998 22:15:53 +0000 (22:15 +0000)
* gtk/gtksignal.c (gtk_signal_newv): Allow a NULL marshaller.
(gtk_signal_connect_by_type): Allow only no_marshal handlers to
connect to signals with a NULL marshaller.

* gtk/gtktypeutils.c (gtk_type_get_info): New.
gtk/gtktypeutils.h (gtk_type_get_info): New prototype.

gtk/gtksignal.c
gtk/gtktypeutils.c
gtk/gtktypeutils.h

index 1f4de6be71133adf81fac3ab6a6cddc5ff6474b2..18f938ae0c3af499b44d82bdaaaa0bb65aae7bf3 100644 (file)
@@ -268,7 +268,6 @@ gtk_signal_newv (const gchar             *r_name,
   gchar *name;
   
   g_return_val_if_fail (r_name != NULL, 0);
-  g_return_val_if_fail (marshaller != NULL, 0);
   g_return_val_if_fail (nparams < MAX_SIGNAL_PARAMS, 0);
   if (nparams)
     g_return_val_if_fail (params != NULL, 0);
@@ -1673,10 +1672,17 @@ gtk_signal_connect_by_type (GtkObject       *object,
   GtkObjectClass *class;
   GtkHandler *handler;
   gint found_it;
-  
+  GtkSignal *signal;
   g_return_val_if_fail (object != NULL, 0);
   g_return_val_if_fail (object->klass != NULL, 0);
   
+  /* A signal without a default marshaller can only take no_marshal
+     handlers. */
+
+  signal = LOOKUP_SIGNAL_ID (signal_id);
+  g_return_val_if_fail (signal->marshaller || no_marshal, 0);
+
   /* Search through the signals for this object and make
    *  sure the one we are adding is valid. We need to perform
    *  the lookup on the objects parents as well. If it isn't
index b7fcf60f5e468916958365129688029d954291ae..e515df6a196dc213f6d774b1b3128b0e6c96c63d 100644 (file)
@@ -257,6 +257,23 @@ gtk_type_unique (GtkType      parent_type,
   return new_type;
 }
 
+gboolean
+gtk_type_get_info (GtkType type,
+                  GtkTypeInfo *info)
+{
+  GtkTypeNode *node;
+
+  if (info == NULL)
+    return FALSE;
+
+  LOOKUP_TYPE_NODE (node, type);
+  if (node == NULL)
+    return FALSE;
+
+  *info = node->type_info;
+  return TRUE;
+}
+
 gchar*
 gtk_type_name (GtkType type)
 {
index 40e70c2c40858fa33db2531e84eb282752c6a4dc..54e5137f9c658d015d4195ce4a9f518dd27b1a39 100644 (file)
@@ -313,6 +313,8 @@ struct _GtkEnumValue
 void           gtk_type_init                   (void);
 GtkType                gtk_type_unique                 (GtkType           parent_type,
                                                 const GtkTypeInfo *type_info);
+gboolean        gtk_type_get_info               (GtkType         type,
+                                                GtkTypeInfo    *info);
 void           gtk_type_set_chunk_alloc        (GtkType         type,
                                                 guint           n_chunks);
 gchar*         gtk_type_name                   (guint           type);